import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/login/login'
import Index from '@/views/index/index'
import Regist from '@/views/regist/index'

import myIndex from '../views/index/component/myIndex'
import index from '../views/index/component/index'
import service from '../views/index/component/service'
import myCar from '../views/index/component/mycar'
import ordering from '../views/index/component/ordering'
import Admin from '../views/admin/component/login'
Vue.use(VueRouter)

const routes = [

    { path: '/', redirect: '/index' },
    {
        path: '/index',
        name: 'Index',
        component: Index,
        children: [
            { path: '', redirect: '/index/myIndex' },
            {
                path: 'index',
                component: index
            }, {
                path: 'myIndex',
                component: myIndex
            },
            {
                path: 'service',
                component: service
            }, {
                path: 'mycar',
                component: myCar
            }, {
                path: 'ordering',
                component: ordering
            }
        ]
    },
    {
        path: '/login',
        name: 'login',
        component: Login
    }, {
        path: '/regist',
        name: 'regist',
        component: Regist
    }, {
        path: '/admin',
        name: 'admin',
        component: Admin
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router